package com.dxy.lc.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import com.dxy.lc.base.Resp;
import java.util.List;

import com.dxy.lc.model.entity.Dept;
import com.dxy.lc.service.DeptService;

/**
* <p>
*  controller
* </p>
*
* @author dxy
* @since 2024-11-07
*/
@Slf4j
@RestController
@RequestMapping("/lc/dept")
public class DeptController {

    @Autowired
    private DeptService service;

    @PostMapping("/add")
    public Resp add(@RequestBody Dept entity) {
        service.add(entity);
        return Resp.bizSuccess();
    }

    @PostMapping("/updById")
    public Resp updById(@RequestBody Dept entity) {
        service.updById(entity);
        return Resp.bizSuccess();
    }

    @PostMapping("/delByIds")
    public Resp delByIds(@RequestBody List<String> ids) {
        service.delByIds(ids);
        return Resp.bizSuccess();
    }

    @GetMapping("/getDetail")
    public Resp<Dept> getDetail(String id) {
        return Resp.bizSuccess(service.getDetail(id));
    }

}